﻿#include "config.hpp"
#include "TitleUI.hpp"
#include "PhysObj.hpp"
#include "MaterialScript.hpp"
#include "OverlayScript.hpp"
#include "ParticleScript.hpp"

//脚本入口函数
int main()
{
	//物理场景初始化
	NxSceneDesc scene;
	scene.gravity = NxVec3(0,-9,0);//重力
	PhysicsManager_I.InitialNX(scene);
	PhysicsManager_I.ConnectToRemoteDebuger();

	//声音引擎初始化
	SoundTool_I;

	//物理引擎挂接到游戏内核
	PhysicsManager_I.PlugTo(GameCore_I);
	SAVE_LOG("物理引擎挂接内核完毕");

	//声音引擎挂接到游戏内核
	SoundTool_I.PlugTo(GameCore_I);
	SAVE_LOG("声音引擎挂接内核完毕");
	
	//网络引擎挂接到游戏内核
	NetManager_I.PlugTo(GameCore_I);
	SAVE_LOG("网络引擎挂接内核完毕");

	return 0;
}

//编译脚本
void Compiler()
{
	SAVE_LOG("编译OGRE脚本");

	CompileOgreMaterialScript();

	CompileOgreOverlayScript();

	CompileOgreParScript();

	SAVE_LOG("编译OGRE脚本完毕");
}

//创建场景
void CreateScene()
{
	//UI系统初始化
	UiSystem_I.Initial();

	//碰撞与触发消息发送器
	@contactSender=ContactSender();	

	//Overlay测试
	Overlay@ openningImg = New_Overlay("Race/PositionOverlay");
	openningImg.show();
	OverlayMng_I.SetMaterial("Race/PositionNum","Race/PositionNumThreeMaterial");

	//游戏场景管理器
	@raceSceneManager_I = RaceSceneManager();
	GameCore_I.RegistScriptObj("raceSceneManager_I",raceSceneManager_I);
	
	//开头UI
	@g_TitleUI = TitleUI();
	GameCore_I.RegistScriptObj("g_TitleUI",g_TitleUI);

}